<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/JD/Public/css/goodsAdd.css">
    <link rel="stylesheet" href="/JD/Public/css/bootstrap.min.css">
    <script src="/JD/Public/js/jquery.js"></script>
</head>
<body>
<div class="by">
    <div class="goodsadd">
        <img src="/JD/Public/img/logo.jpg" alt="">
        <h1>添加商品页</h1>
    </div>
    <div class="container box">
    <form method="post"  action="/JD/index.php/Home/Ament/addGoods" enctype="multipart/form-data">
        <div class="form-group"  >
            <label >商品名称</label>
            <input  class="form-control ww" name="goods_name"   required="required">
        </div>
        <div class="form-group">
            <label >品牌</label>
            <select name="goods_brand_id" id="f_goods_category_id">
                <option value="0">请选择</option>
            </select>
        </div>
        <div class="form-group">
            <label >商品数量</label>
            <input  class="form-control" name="goods_number"  required="required">
        </div>
        <div class="form-group">
            <label >商品规格</label>
            <input  class="form-control" name="goods_weight" required="required">
        </div>
        <div class="form-group">
            <label >商品价格</label>
            <input  class="form-control" name="goods_price"  required="required">
        </div>
        <div class="form-group">
            <label >产品介绍</label>
            <textarea class="form-control" name="goods_introduce" rows="3" required="required" ></textarea>
        </div>
        <div class="form-group">
            <label >上传商品图片</label>
            <input type="file" name="goods_img">

        </div>

        <button type="submit" class="btn btn-default">添加商品</button>
    </form>
    </div>
</div>
<script>
    $(function(){
        //请求后端接口，拿到所有分类信息
        $.get("/JD/index.php/Home/Ament/getAllCate",function(res){
            var allCate=res;
            var list='';
            for(var i= 0;i<allCate.length;i++){
                list+='<option value="'+allCate[i].cat_id+'">'+allCate[i].cat_name+'</option>'
            }
            $("#f_goods_category_id option").first().after(list);
        })
        //获取所有的品牌显示到页面




    })
</script>
</body>
</html>